<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.3/themes/default/style.min.css"/>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/search-panel.css">
    <link rel="stylesheet" href="css/scene-viewer.css">
    <link rel="stylesheet" href="css/toolbar.css">
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.min.css">
    <title>Simulator</title>
    <meta charset="utf-8">
</head>

<body>
<!-- UI Markup -->

<div id="main">
    <div id="canvas"></div>
    <div id="sceneToolbar" class="toolbar" style="display:none"></div>
    <div id="console" class="console" style="display:none"></div>
</div>
<div id="sidebar" style="overflow: auto;">
    Map
    <div id="map" style="z-index: 10;"></div>
    Goals
    <div id="goals" style="z-index: 10;"></div>
    Observations
    <input id="autoUpdate" type="checkbox"/>Update
    <div id="sensors" style="z-index: 10;"></div>
</div>
<div id="editPanel" class="sidebar" style="display:none; background: white;">
Search Panel
<div id="modelSearchPanel" class="searchPanel">
</div>
</div>

<!-- This is ridiculous!!!! We need a system where all dependencies are specified in one place.
     Please revert back to using require.js and get rid of these -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.3/jstree.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.12/d3.min.js"></script>
<script src="three.min.js"></script>
<script src="common.bundle.js"></script>
<script src="STK.bundle.js"></script>
<script>
  var simviewer = new STK.SimViewer({
    container: document.getElementById('canvas'),
    mapContainer: document.getElementById('map'),
    goalsContainer: document.getElementById('goals'),
    sensorsContainer: document.getElementById('sensors'),
    console: '#console'
  });
  var autoUpdateCheckbox = $("#autoUpdate");
  autoUpdateCheckbox.change(function() {
    simviewer.__autoUpdateObservations = autoUpdateCheckbox.prop('checked');
  });
  simviewer.Subscribe('Launch', simviewer, function() {
    simviewer.addWaiting('RegisterCustomAssets');
    simviewer.simulator.assetManager.registerCustomAssetGroups({
      assetFiles: STK.Constants.scanAssetsFile,
      filterByAssetId: simviewer.allParams.scene.fullId,
      callback: function(err, res) {
        simviewer.removeWaiting('RegisterCustomAssets');
      }
    });
  });
  window.simviewer = simviewer;  // DEBUG
  simviewer.launch();
</script>
</body>
</html>
